/**
 * 极光相关接口api
 */

const base64_auth_string = 'Basic NWZjZWRkNTAxZmQ3OTYzNjgxNDNkNzRlOjQyOTFkMDlmZDY3ZjQ3ZjdmOWIyZDY5MQ=='
// 上传照片
const jmUploadPic = (imgurl) => {
	
	const url = 'https://api.im.jpush.cn/v1/resource?type=image'
	uni.chooseImage({
		// 从本地相册选择图片或使用相机拍照。
		count: 1, //默认选择1张图片
		sizeType: ['original', 'compressed'], //original 原图，compressed 压缩图，默认二者都有
		success: res1 => {
			const img = res1.tempFilePaths[0]
			const path = res1.tempFilePaths[0];
			const formData = new FormData()
			formData.append('filename', path)
			uni.request({
				url: url,
				header: {
					"Authorization": base64_auth_string
				},
				method:'POST',
				data:formData,
				success(data) {
					debugger
				},
				fail(data) {
					
				}
			})
		},
		fail: res => {
			console.log(res)
		}
	});
}
export  {
	jmUploadPic
}